<?php
require './include/global.php';
if(!$_SESSION[uname]){
require_once 'include/train_db.php';
}

$job_contact_type = "";
$and_sql = "";
switch($_SESSION["usertype"]){
	case 'employer':
		$job_contact_type = 3;
		$and_sql = " WHERE FIND_IN_SET('2', jo_contact) OR FIND_IN_SET('3', jo_contact)";
		break;
	case 'recruiter':
		$job_contact_type = 2;
		$and_sql = " WHERE FIND_IN_SET('2', jo_contact) OR FIND_IN_SET('3', jo_contact)";
		break;
	case 'candidate':
		$job_contact_type = 1;
		$and_sql = " WHERE FIND_IN_SET('1', jo_contact)";
		break;
	default:
		break;
}

$nav = new buildNav;
$nav->limit = 25;
$total = $DB->fetch_one_array("SELECT COUNT(*) AS count FROM pa_job ".$and_sql);
$nav->total_result = $total[count];
$nav->execute("SELECT * FROM pa_job ".$and_sql." ORDER BY jo_id DESC");

$page = $nav->pagenav();
$smarty->assign("page",$page);

$i=0;
while($list2 = $DB->fetch_array($nav->sql_result)){
   $data[$i]              =   $list2;
   $data[$i][location]    =  $list2[jo_city].", ".$state[$list2[jo_state]] ;
   $data[$i][regtime]     =   date("m/d/Y",$list2[jo_regtime]);
   $i++;
}
$smarty->assign("joblist",$data);


$smarty->display('header.tpl');
if($_SESSION[uname]){
require './include/all_left.php';
$smarty->display('allleft.tpl');
}else{
$smarty->display('left.tpl');
}


$smarty->display('job.tpl');


if($_SESSION[uname]){
require_once './include/advisory_db.php';
$smarty->display('allright.tpl');
}else{
$smarty->display('right.tpl');
}
$smarty->display('footer.tpl');
?>
